Charging method and related device

ABSTRACT

An electronic device comprises a processor, a charging port, and memory that stores program code. When the program code is executed by the processor, the electronic device charges a battery of the electronic device using the charging port when a charger is connected to the charging port, stops charging in response to detecting that the charging port is abnormal, and displays a first window on a display interface of the electronic device in response to detecting that the charging port is abnormal. The first window comprises a first prompt information and a second prompt information. The first prompt information is used to prompt that liquid intake exists in the charging port, and the second prompt information is used to prompt a user to exclude a liquid intake situation of the charging port.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/828,508 filed on Mar. 24, 2020, which is a continuation of U.S.patent application Ser. No. 16/095,848 filed on Oct. 23, 2018, now U.S.Pat. No. 10,630,091. U.S. patent application Ser. No. 16/095,848 is anational stage of International Patent Application No. PCT/CN2016/105856filed on Nov. 15, 2016. All of the aforementioned patent applicationsare hereby incorporated by reference in their entireties.

TECHNICAL FIELD

The present invention relates to the field of electronic technologies,and in particular, to a charging method and a related device.

BACKGROUND

With rapid development of electronic technologies, upgrading of userterminals accelerates. For example, commonly used user terminals such asmobile phones, tablet computers, wearable devices have become animportant part of people's daily life. Most user terminals need to becharged by using a power supply device. In an example of a mobile phone,one Universal Serial Bus (Universal Serial Bus, USB) port, on a chargingdata cable, that is used to connect to a power source and that matchesthe mobile phone is connected to a power source charger or a computer,and the other USB port on the charging data cable is connected to acharging port of the mobile phone, to charge the mobile phone.

In an actual application, in a charging process of the user terminal, aleakage current at the charging port, an extremely high current, and anextremely high voltage may cause damage to the mobile phone to someextent. In an existing technical solution, a protection circuit designedinside the user terminal can protect the user terminal from theextremely high current or the extremely high voltage. However, in a caseof a short circuit at the charging port, before flowing into theprotection circuit inside the user terminal, some currents flowingthrough the charging port are short-circuited to ground. In this case,if a current detected by the protection circuit does not exceed a presetcurrent threshold, the protection circuit considers that charging isnormal, and the user terminal remains in a charging state. This causesthe charging port to be burned due to the extremely high current, andreduces charging security of the user terminal.

SUMMARY

Embodiments of the present invention provide a charging method and arelated device. A charging current is monitored in real time, so that auser terminal monitors whether a leakage current exists in a currentcharging process, and in a case of the leakage current, a power cable isdisconnected in time by using a charge protection apparatus, so as toprotect the user terminal.

According to a first aspect, an embodiment of the present inventionprovides a charge protection apparatus, where the charge protectionapparatus is connected to a charging cable, and the charging cableincludes a power cable and a data cable;

the charge protection apparatus includes a micro control unit MCU, acurrent detection circuit, a gating circuit, and an I/O interface;

the current detection circuit and the gating circuit are disposed on thepower cable; if the gating circuit is in a closed state, the power cableis not disconnected from charging, or if the gating circuit is in anopen state, the power cable is disconnected from charging; the I/Ointerface and the data cable are connected; and the MCU sends data byusing the I/O interface; and

the current detection circuit detects an external charging currentflowing through the power cable; the current detection circuit transmitsthe external charging current to the MCU; the MCU transmits the externalcharging current to a user terminal by using the I/O interface, so thatthe user terminal calculates a current difference between the externalcharging current and an internal charging current detected by the userterminal, and determines, based on the current difference, whether togenerate a circuit control command; and the MCU receives the circuitcontrol command sent by the user terminal, and controls, according tothe circuit control command, the gating circuit to be in the closedstate or the open state.

According to the first aspect of the embodiments of the presentinvention, a charging current is monitored in real time, so that theuser terminal monitors whether a leakage current exists in a currentcharging process, and in a case of the leakage current, the power cableis disconnected from charging in time by using the charge protectionapparatus, so as to protect the user terminal.

With reference to the first aspect, in a first implementation of thefirst aspect, the charge protection apparatus further includes atemperature detection circuit;

the temperature detection circuit detects a temperature of the chargingcable, and transmits the temperature of the charging cable to the MCU;and the MCU transmits the temperature of the charging cable to the userterminal by using the I/O interface, so that the user terminaldetermines, based on the temperature of the charging cable, whether togenerate the circuit control command; and

the MCU receives the circuit control command sent by the user terminal,and controls, according to the circuit control command, the gatingcircuit to be in the closed state or the open state.

Optionally, the charge protection apparatus is disposed at a positionclose to a USB port connected to a charging port of the user terminal,so that the temperature detection circuit can more accurately detect thetemperature of the charging port of the user terminal.

With reference to the first aspect or the first implementation of thefirst aspect, in a second implementation of the first aspect, the chargeprotection apparatus further includes a voltage detection circuit, andthe voltage detection circuit is disposed on the power cable;

the voltage detection circuit detects an external charging voltage ofthe power cable, and transmits the external charging voltage to the MCU;and the MCU transmits the external charging voltage to the user terminalby using the I/O interface, so that the user terminal determines, basedon the external charging voltage, whether to generate the circuitcontrol command; and

the MCU receives the circuit control command sent by the user terminal,and controls, according to the circuit control command, the gatingcircuit to be in the closed state or the open state.

With reference to the first aspect, the first implementation of thefirst aspect, or the second implementation of the first aspect, in athird implementation of the first aspect, the controlling, according tothe circuit control command, the gating circuit to be in the closedstate or the open state includes:

if the circuit control command is to keep charging, the MCU controls thegating circuit to be in the closed state; or if the circuit controlcommand is to disconnect from charging, the MCU controls the gatingcircuit to be in the open state.

With reference to the first aspect, the first implementation of thefirst aspect, the second implementation of the first aspect, or thethird implementation of the first aspect, in a fourth implementation ofthe first aspect, the charge protection apparatus further includes aprompt circuit, the charge protection apparatus further includes abuzzer, an indicator, and/or an oscillator, and the prompt circuit isconfigured to control whether the buzzer rings, control whether theindicator flickers, and/or control whether the oscillator oscillates;and

if a first warning prompt is set in the circuit control command, the MCUperforms a warning operation according to the first warning prompt byusing the prompt circuit.

Optionally, the first warning prompt carries a first time interval for afirst prompt mode and a second time interval for a second prompt mode;and that the MCU controls, according to the first warning prompt byusing the prompt circuit, the buzzer to ring and the indicator toflicker is specifically: the MCU performs, based on a time interval foreach prompt mode by using the prompt circuit, an operation correspondingto each prompt mode.

Optionally, the prompt circuit is configured to control whether thebuzzer rings, control whether the indicator flickers, and/or controlwhether the oscillator oscillates. The charge protection apparatus mayinclude one or more of the buzzer, the indicator, and the oscillator. Itmay be understood that, if the buzzer is included, the first warningprompt may include a prompt mode in which the buzzer rings; if theindicator is included, the first warning prompt may include a promptmode in which the indicator flickers; or if the oscillator is included,the first warning prompt may include a prompt mode in which theoscillator oscillates.

Further, optionally, when the first warning prompt may include aplurality of prompt modes, one or more of the prompt modes may beselected for prompting. This is not limited in this embodiment of thepresent invention. In this way, a user is prompted in the prompt mode,so that the user can learn of a current charging status in time.

With reference to the first aspect, the first implementation of thefirst aspect, the second implementation of the first aspect, the thirdimplementation of the first aspect, or the fourth implementation of thefirst aspect, in a fifth implementation of the first aspect, the chargeprotection apparatus further includes a port status detection circuit,and the port status detection circuit and the gating circuit areconnected in parallel; and

when the gating circuit is in the open state, if the port statusdetection circuit detects that the gating circuit is disconnected fromthe power supply apparatus or is disconnected from the charging port ofthe user terminal, the port status detection circuit notifies the MCUthat the port connection has been broken, and the MCU controls thegating circuit to be in the closed state.

Optionally, the port status detection circuit may include a currentlimiting resistor and a micro current detection circuit. Because theport status detection circuit and the gating circuit are connected inparallel, the port status detection circuit is equivalent to anotherclosed circuit on the power cable. However, herein, setting a resistancevalue of the current limiting resistor can enable a current of theclosed circuit to be at a milliampere scale or even smaller, and thecurrent can be detected by using the micro current detection circuit.Therefore, once the gating circuit is in the open state, the port statusdetection circuit notifies the MCU that the gating circuit isdisconnected from the charging port, so that the MCU controls the gatingcircuit to restore to the closed state, helping the charge protectionapparatus perform protection for a next charging connection.

According to a second aspect, an embodiment of the present inventionprovides a charging data cable, where the charging data cable includesthe charge protection apparatus provided in the first aspect. In thisembodiment of the present invention, the charging data cable may receivea circuit control command that is generated by a user terminal based ona result of comparison between an internal charging current and anexternal charging current, and further control whether a power cable isdisconnected from charging, so as to protect the user terminal. Thecharge protection apparatus is usually disposed near a port of the userterminal on the charging data cable.

According to a third aspect, an embodiment of the present inventionprovides a charger, where the charger includes the charge protectionapparatus provided in the first aspect. In this embodiment of thepresent invention, the charger may receive a circuit control commandthat is generated by a user terminal based on a result of comparisonbetween an internal charging current and an external charging current,and further control whether a power cable is disconnected from charging,so as to protect the user terminal.

According to a fourth aspect, an embodiment of the present inventionprovides a charge protection apparatus, where the charge protectionapparatus is connected to a charging cable, the charging cable includesa power cable and a data cable, and the charge protection apparatusincludes a detection unit, a sending unit, a receiving unit, and acontrol unit;

the control unit is configured to detect an external charging current ofthe power cable by using the detection unit;

the control unit is further configured to send the external chargingcurrent to a user terminal by using the sending unit, so that the userterminal calculates a current difference between the external chargingcurrent and an internal charging current detected by the user terminal,and determines, based on the current difference, whether to generate acircuit control command;

the control unit is further configured to receive, by using thereceiving unit, the circuit control command sent by the user terminal;and

the control unit is further configured to control, according to thecircuit control command, whether the power cable is disconnected fromcharging.

According to the fourth aspect of the embodiments of the presentinvention, a charging current is monitored in real time, so that theuser terminal monitors whether a leakage current exists in a currentcharging process, and in a case of the leakage current, the power cableis disconnected from charging in time by using the charge protectionapparatus, so as to protect the user terminal.

With reference to the fourth aspect, in a first implementation of thefourth aspect, the control unit is further configured to: detect atemperature of the charging cable by using the detection unit, and sendthe temperature of the charging cable to the user terminal, so that theuser terminal determines, based on the temperature of the chargingcable, whether to generate the circuit control command. Therefore, acharging port can be better protected by performing temperaturedetection.

With reference to the fourth aspect or the first implementation of thefourth aspect, in a second implementation of the fourth aspect, thecontrol unit is further configured to: detect an external chargingvoltage of the power cable by using the detection unit, and send theexternal charging voltage to the user terminal, so that the userterminal determines, based on the external charging voltage, whether togenerate the circuit control command. The user terminal can be betterprotected by performing external charging voltage detection.

With reference to the fourth aspect, the first implementation of thefourth aspect, or the second implementation of the fourth aspect, in athird implementation of the fourth aspect, with regard to thecontrolling, according to the circuit control command, whether the powercable is disconnected from charging, the control unit is specificallyconfigured to:

if the circuit control command is to keep charging, control the powercable to remain in a charging connection; or if the circuit controlcommand is to disconnect from charging, control the power cable todisconnect from charging. It may be understood that, if the circuitcontrol command sent by the user terminal is not received, the chargingdata cable remains in a charging state, and in this case, the powercable remains in the charging connection.

With reference to the third implementation of the fourth aspect, in afourth implementation of the fourth aspect, the control unit is furtherconfigured to: if a first warning prompt is set in the circuit controlcommand, perform a warning operation according to the first warningprompt.

Optionally, at least one prompt mode and a time interval for executingeach prompt mode are set in the first warning prompt; and

the control unit is specifically configured to: if the first warningprompt is set in the circuit control command, perform, based on the timeinterval for each prompt mode, an operation corresponding to each promptmode.

Optionally, when the first warning prompt may include a plurality ofprompt modes, one or more of the prompt modes may be selected forprompting. This is not limited in this embodiment of the presentinvention. In this way, a user is prompted in the prompt mode, so thatthe user can learn of a current charging status in time.

With reference to the fourth aspect, the first implementation of thefourth aspect, the second implementation of the fourth aspect, the thirdimplementation of the fourth aspect, or the fourth implementation of thefourth aspect, in a fifth implementation of the fourth aspect, thecontrol unit is further configured to: when the power cable isdisconnected from charging, if it is detected that the power cable isdisconnected from the power supply apparatus or is disconnected from thecharging port of the user terminal, control the power cable to establisha charging connection.

According to a fifth aspect, an embodiment of the present inventionprovides a charging data cable, where the charging data cable includesthe charge protection apparatus provided in the first aspect. In thisembodiment of the present invention, the charging data cable may receivea circuit control command that is generated by a user terminal based ona result of comparison between an internal charging current and anexternal charging current, and further control whether a power cable isdisconnected from charging, so as to protect the user terminal. Thecharge protection apparatus is usually disposed near a port of the userterminal on the charging data cable.

According to a sixth aspect, an embodiment of the present inventionprovides a charger, where the charger includes the charge protectionapparatus provided in the first aspect. In this embodiment of thepresent invention, the charger may receive a circuit control commandthat is generated by a user terminal based on a result of comparisonbetween an internal charging current and an external charging current,and further control whether a power cable is disconnected from charging,so as to protect the user terminal.

According to a seventh aspect, an embodiment of the present inventionprovides a user terminal, including a detection unit, a receiving unit,a processing unit, and a sending unit;

the processing unit is configured to detect an internal charging currentby using the detection unit;

the processing unit is further configured to receive, by using thereceiving unit, an external charging current sent by the chargeprotection apparatus;

the processing unit is further configured to calculate a currentdifference between the external charging current and the internalcharging current;

the processing unit is further configured to determine, based on thecurrent difference, whether to generate a circuit control command; and

the processing unit is further configured to: if the circuit controlcommand is generated, send the circuit control command to the chargeprotection apparatus by using the sending unit.

According to the seventh aspect of the embodiments of the presentinvention, a charging current is monitored in real time, so that theuser terminal monitors whether a leakage current exists in a currentcharging process, and in a case of the leakage current, a power cable isdisconnected from charging in time by using the charge protectionapparatus, so as to protect the user terminal.

With reference to the seventh aspect, in a first implementation of theseventh aspect, with regard to the determining, based on the currentdifference, whether to generate a circuit control command, theprocessing unit is specifically configured to:

if the current difference is greater than a first current threshold andless than a second current threshold, determine that the generatedcircuit control command is to keep charging; or if the currentdifference is greater than the second current threshold and less than athird current threshold, determine that the generated circuit controlcommand is to disconnect from charging.

It may be understood that, if the current difference is less than thefirst current threshold, the user terminal does not generate the circuitcontrol command.

With reference to the first implementation of the seventh aspect, in asecond implementation of the seventh aspect, the user terminal furtherincludes a first output unit;

the processing unit is further configured to: if the current differenceis greater than the first current threshold and less than the secondcurrent threshold, output a first pop-up prompt on a screen by using thefirst output unit, where the first pop-up prompt is a prompt messageused to indicate that the current difference exists in a currentcharging process; and

the processing unit is further configured to: if the current differenceis greater than the second current threshold and less than the thirdcurrent threshold, output a second pop-up prompt on the screen by usingthe first output unit, where the second pop-up prompt is a promptmessage used to indicate that the current difference exists in thecurrent charging process and charging is disconnected.

The pop-up prompt may be used to instruct a user to check in timewhether there is a problem of liquid intake, corrosion, or the like fora charging port of the user terminal.

With reference to the seventh aspect, the first implementation of theseventh aspect, or the second implementation of the seventh aspect, in athird implementation of the seventh aspect, the processing unit isfurther configured to receive, by using the receiving unit, atemperature of a charging cable that is sent by the charge protectionapparatus; and the processing unit is further configured to determine,based on the temperature of the charging cable, whether to generate thecircuit control command. The charging port can be better protected byusing a temperature detection mechanism.

With reference to the third implementation of the seventh aspect, in afourth implementation of the seventh aspect, with regard to thedetermining, based on the temperature of the charging cable, whether togenerate the circuit control command, the processing unit isspecifically configured to:

if the temperature of the charging cable is greater than a firsttemperature threshold and less than a second temperature threshold,determine that the generated circuit control command is to keepcharging; or if the temperature of the charging cable is greater thanthe second temperature threshold, determine that the generated circuitcontrol command is to disconnect from charging.

It may be understood that, if the temperature of the charging cable isless than the first temperature threshold, the user terminal does notgenerate the circuit control command.

With reference to the fourth implementation of the seventh aspect, in afifth implementation of the seventh aspect, the user terminal furtherincludes a second output unit;

the processing unit is further configured to: if the temperature of thecharging cable is greater than the first temperature threshold and lessthan the second temperature threshold, output a third pop-up prompt onthe screen by using the second output unit, where the third pop-upprompt is a prompt message used to indicate that the temperature of thecharging cable is extremely high in the current charging process; and

the processing unit is further configured to: if the temperature of thecharging cable is greater than the second temperature threshold and lessthan the third temperature threshold, output a fourth pop-up prompt onthe screen by using the second output unit, where the fourth pop-upprompt is a prompt message used to indicate that the temperature of thecharging cable is extremely high in the current charging process andcharging is disconnected.

The pop-up prompt may be used to instruct the user to check in timewhether there is a problem of liquid intake, corrosion, or the like forthe charging port of the user terminal.

With reference to the seventh aspect, the first implementation of theseventh aspect, the second implementation of the seventh aspect, thethird implementation of the seventh aspect, the fourth implementation ofthe seventh aspect, or the fifth implementation of the seventh aspect,in a sixth implementation of the seventh aspect, the processing unit isfurther configured to receive, by using the receiving unit, an externalcharging voltage sent by the charge protection apparatus; and

the processing unit is further configured to determine, based on theexternal charging voltage, whether to generate the circuit controlcommand. The user terminal can be better protected by performingexternal charging voltage detection.

With reference to the sixth implementation of the seventh aspect, in aseventh implementation of the seventh aspect, with regard to thedetermining, based on the external charging voltage, whether to generatethe circuit control command, the processing unit is specificallyconfigured to:

if the external charging voltage is greater than a first voltagethreshold and less than a second voltage threshold, determine that thegenerated circuit control command is to keep charging; or if theexternal charging voltage is greater than the second voltage threshold,determine that the generated circuit control command is to disconnectfrom charging.

It may be understood that, if the external charging voltage of the powercable is less than the first voltage threshold, the user terminal doesnot generate the circuit control command.

With reference to the seventh implementation of the seventh aspect, inan eighth implementation of the seventh aspect, the user terminalfurther includes a third output unit;

the processing unit is further configured to: if the external chargingvoltage is greater than the first voltage threshold and less than thesecond voltage threshold, output a fifth pop-up prompt on the screen byusing the third output unit, where the fifth pop-up prompt is a promptmessage used to indicate that the external charging voltage is extremelyhigh in the current charging process; and

the processing unit is further configured to: if the external chargingvoltage is greater than the second voltage threshold and less than thethird voltage threshold, output a sixth pop-up prompt on the screen byusing the third output unit, where the sixth pop-up prompt is a promptmessage used to indicate that the external charging voltage is extremelyhigh in the current charging process and charging is disconnected.

The pop-up prompt may be used to instruct the user to check in timewhether there is a problem of liquid intake, corrosion, or the like forthe charging port of the user terminal.

Optionally, the user terminal further includes a fourth output unit; andthe processing unit is further configured to output the internalcharging current, the external charging current, and the externalcharging voltage on the screen by using the fourth output unit.

Optionally, the processing unit may output at least one of the internalcharging current, the external charging current, and the externalcharging voltage.

Optionally, a first warning prompt is set in the circuit controlcommand, and the first warning prompt is used to instruct the chargeprotection apparatus to perform a warning operation according to thefirst warning prompt. Further, optionally, at least one prompt mode anda time interval for executing each prompt mode are set in the firstwarning prompt.

With reference to the seventh aspect, the first implementation of theseventh aspect, the second implementation of the seventh aspect, thethird implementation of the seventh aspect, the fourth implementation ofthe seventh aspect, the fifth implementation of the seventh aspect, thesixth implementation of the seventh aspect, the seventh implementationof the seventh aspect, or the eighth implementation of the seventhaspect, in a ninth implementation of the seventh aspect, the processingunit is further configured to perform a warning operation based on apreset second warning prompt if the circuit control command isgenerated, where the second warning prompt includes at least one promptmode. For example, the prompt mode may include one or more of a soundprompt mode, a flicker prompt mode, and an oscillation prompt mode, andthe prompt mode in the second warning prompt is not limited to theseprompt modes. The circuit control command may be a command for keepingcharging or disconnecting from charging, and therefore the user terminalmay set different prompt modes for different commands. In this way, theuser is prompted in the prompt mode, so that the user can learn of acurrent charging status in time.

According to an eighth aspect, an embodiment of the present inventionprovides a charging method, where the method is applied to a chargeprotection apparatus, a charging cable in the charge protectionapparatus includes a power cable and a data cable, and the methodincludes:

detecting, by the charge protection apparatus, an external chargingcurrent of the power cable;

sending, by the charge protection apparatus, the external chargingcurrent to a user terminal, so that the user terminal calculates acurrent difference between the external charging current and an internalcharging current detected by the user terminal, and determines, based onthe current difference, whether to generate a circuit control command;

receiving, by the charge protection apparatus, the circuit controlcommand sent by the user terminal; and

controlling, by the charge protection apparatus according to the circuitcontrol command, whether the power cable is disconnected from charging.

According to the eighth aspect of the embodiments of the presentinvention, a charging current is monitored in real time, so that theuser terminal monitors whether a leakage current exists in a currentcharging process, and in a case of the leakage current, the power cableis disconnected from charging in time by using the charge protectionapparatus, so as to protect the user terminal.

With reference to the eighth aspect, in a first implementation of theeighth aspect, before the receiving, by the charge protection apparatus,the circuit control command sent by the user terminal, the methodfurther includes:

detecting, by the charge protection apparatus, a temperature of thecharging cable, and sending the temperature of the charging cable to theuser terminal, so that the user terminal determines, based on thetemperature of the charging cable, whether to generate the circuitcontrol command. Therefore, a charging port can be better protected byperforming temperature detection.

With reference to the eighth aspect or the first implementation of theeighth aspect, in a second implementation of the eighth aspect, beforethe receiving, by the charge protection apparatus, the circuit controlcommand sent by the user terminal, the method further includes:

detecting, by the charge protection apparatus, an external chargingvoltage of the power cable, and sending the external charging voltage tothe user terminal, so that the user terminal determines, based on theexternal charging voltage, whether to generate the circuit controlcommand. The user terminal can be better protected by performingexternal charging voltage detection.

With reference to the eighth aspect, the first implementation of theeighth aspect, or the second implementation of the eighth aspect, in athird implementation of the eighth aspect, the controlling, by thecharge protection apparatus according to the circuit control command,whether the power cable is disconnected from charging includes:

if the circuit control command is to keep charging, controlling, by thecharge protection apparatus, the power cable to remain in a chargingconnection; or if the circuit control command is to disconnect fromcharging, controlling, by the charge protection apparatus, the powercable to disconnect from charging. It may be understood that, if thecircuit control command sent by the user terminal is not received, thecharging data cable remains in a charging state, and in this case, thepower cable remains in the charging connection.

With reference to the third implementation of the eighth aspect, in afourth implementation of the eighth aspect, the method further includes:

performing, by the charge protection apparatus if a first warning promptis set in the circuit control command, a warning operation according tothe first warning prompt.

Optionally, at least one prompt mode and a time interval for executingeach prompt mode are set in the first warning prompt; and theperforming, by the charge protection apparatus if a first warning promptis set in the circuit control command, a warning operation according tothe first warning prompt includes: if the first warning prompt is set inthe circuit control command, performing, by the charge protectionapparatus based on the time interval for each prompt mode, an operationcorresponding to each prompt mode.

Optionally, when the first warning prompt may include a plurality ofprompt modes, one or more of the prompt modes may be selected forprompting. This is not limited in this embodiment of the presentinvention. In this way, a user is prompted in the prompt mode, so thatthe user can learn of a current charging status in time.

With reference to the eighth aspect, the first implementation of theeighth aspect, the second implementation of the eighth aspect, the thirdimplementation of the eighth aspect, or the fourth implementation of theeighth aspect, in a fifth implementation of the eighth aspect, themethod further includes:

when the power cable is disconnected from charging, if it is detectedthat the power cable is disconnected from the power supply apparatus oris disconnected from the charging port of the user terminal,controlling, by the charge protection apparatus, the power cable toestablish a charging connection.

According to a ninth aspect, an embodiment of the present inventionprovides a charging method, including:

detecting, by a user terminal, an internal charging current;

receiving, by the user terminal, an external charging current sent bythe charge protection apparatus;

calculating, by the user terminal, a current difference between theexternal charging current and the internal charging current;

determining, by the user terminal based on the current difference,whether to generate a circuit control command; and

sending, by the user terminal, the circuit control command to the chargeprotection apparatus if the circuit control command is generated.

According to the ninth aspect of the embodiments of the presentinvention, a charging current is monitored in real time, so that theuser terminal monitors whether a leakage current exists in a currentcharging process, and in a case of the leakage current, a power cable isdisconnected from charging in time by using the charge protectionapparatus, so as to protect the user terminal.

With reference to the ninth aspect, in a first implementation of theninth aspect, the determining, by the user terminal based on the currentdifference, whether to generate a circuit control command includes:

if the current difference is greater than a first current threshold andless than a second current threshold, determining, by the user terminal,that the generated circuit control command is to keep charging; or ifthe current difference is greater than the second current threshold andless than a third current threshold, determining, by the user terminal,that the generated circuit control command is to disconnect fromcharging.

It may be understood that, if the current difference is less than thefirst current threshold, the user terminal does not generate the circuitcontrol command.

With reference to the first implementation of the ninth aspect, in asecond implementation of the ninth aspect, the method further includes:

if the current difference is greater than the first current thresholdand less than the second current threshold, outputting, by the userterminal, a first pop-up prompt on a screen, where the first pop-upprompt is a prompt message used to indicate that the current differenceexists in a current charging process; or if the current difference isgreater than the second current threshold and less than the thirdcurrent threshold, outputting, by the user terminal, a second pop-upprompt on the screen, where the second pop-up prompt is a prompt messageused to indicate that the current difference exists in the currentcharging process and charging is disconnected.

The pop-up prompt may be used to instruct a user to check in timewhether there is a problem of liquid intake, corrosion, or the like fora charging port of the user terminal.

With reference to the ninth aspect, the first implementation of theninth aspect, or the second implementation of the ninth aspect, in athird implementation of the ninth aspect, before the sending, by theuser terminal, the circuit control command to the charge protectionapparatus if the circuit control command is generated, the methodfurther includes:

receiving, by the user terminal, a temperature of a charging cable thatis sent by the charge protection apparatus; and determining, by the userterminal based on the temperature of the charging cable, whether togenerate the circuit control command. The charging port can be betterprotected by using a temperature detection mechanism.

With reference to the third implementation of the ninth aspect, in afourth implementation of the ninth aspect, the determining, by the userterminal based on the temperature of the charging cable, whether togenerate the circuit control command includes:

if the temperature of the charging cable is greater than a firsttemperature threshold and less than a second temperature threshold,determining, by the user terminal, that the generated circuit controlcommand is to keep charging; or if the temperature of the charging cableis greater than the second temperature threshold, determining, by theuser terminal, that the generated circuit control command is todisconnect from charging.

It may be understood that, if the temperature of the charging cable isless than the first temperature threshold, the user terminal does notgenerate the circuit control command.

With reference to the fourth implementation of the ninth aspect, in afifth implementation of the ninth aspect, the method further includes:

if the temperature of the charging cable is greater than the firsttemperature threshold and less than the second temperature threshold,outputting, by the user terminal, a third pop-up prompt on the screen,where the third pop-up prompt is a prompt message used to indicate thatthe temperature of the charging cable is extremely high in the currentcharging process; or if the temperature of the charging cable is greaterthan the second temperature threshold and less than the thirdtemperature threshold, outputting, by the user terminal, a fourth pop-upprompt on the screen, where the fourth pop-up prompt is a prompt messageused to indicate that the temperature of the charging cable is extremelyhigh in the current charging process and charging is disconnected.

The pop-up prompt may be used to instruct the user to check in timewhether there is a problem of liquid intake, corrosion, or the like forthe charging port of the user terminal.

With reference to the ninth aspect, the first implementation of theninth aspect, the second implementation of the ninth aspect, the thirdimplementation of the ninth aspect, the fourth implementation of theninth aspect, or the fifth implementation of the ninth aspect, in asixth implementation of the ninth aspect, before the sending, by theuser terminal, the circuit control command to the charge protectionapparatus if the circuit control command is generated, the methodfurther includes:

receiving, by the user terminal, an external charging voltage sent bythe charge protection apparatus; and determining, based on the externalcharging voltage, whether to generate the circuit control command. Theuser terminal can be better protected by performing external chargingvoltage detection.

With reference to the sixth implementation of the ninth aspect, in aseventh implementation of the ninth aspect, the determining, by the userterminal based on the external charging voltage, whether to generate thecircuit control command includes:

if the external charging voltage is greater than a first voltagethreshold and less than a second voltage threshold, determining, by theuser terminal, that the generated circuit control command is to keepcharging; or if the external charging voltage is greater than the secondvoltage threshold, determining, by the user terminal, that the generatedcircuit control command is to disconnect from charging.

It may be understood that, if the external charging voltage of the powercable is less than the first voltage threshold, the user terminal doesnot generate the circuit control command.

With reference to the seventh implementation of the ninth aspect, in aneighth implementation of the ninth aspect, the method further includes:

if the external charging voltage is greater than the first voltagethreshold and less than the second voltage threshold, outputting, by theuser terminal, a fifth pop-up prompt on the screen, where the fifthpop-up prompt is a prompt message used to indicate that the externalcharging voltage is extremely high in the current charging process; orif the external charging voltage is greater than the second voltagethreshold and less than the third voltage threshold, outputting, by theuser terminal, a sixth pop-up prompt on the screen, where the sixthpop-up prompt is a prompt message used to indicate that the externalcharging voltage is extremely high in the current charging process andcharging is disconnected.

The pop-up prompt may be used to instruct the user to check in timewhether there is a problem of liquid intake, corrosion, or the like forthe charging port of the user terminal.

Optionally, the method further includes: outputting the internalcharging current, the external charging current, and the externalcharging voltage on the screen. Further, optionally, the processing unitmay output at least one of the internal charging current, the externalcharging current, and the external charging voltage.

Optionally, a first warning prompt is set in the circuit controlcommand, and the first warning prompt is used to instruct the chargeprotection apparatus to perform a warning operation according to thefirst warning prompt. Further, optionally, at least one prompt mode anda time interval for executing each prompt mode are set in the firstwarning prompt.

With reference to the ninth aspect, the first implementation of theninth aspect, the second implementation of the ninth aspect, the thirdimplementation of the ninth aspect, the fourth implementation of theninth aspect, the fifth implementation of the ninth aspect, the sixthimplementation of the ninth aspect, the seventh implementation of theninth aspect, or the eighth implementation of the ninth aspect, in aninth implementation of the ninth aspect, the method further includes:

performing, by the user terminal, a warning operation based on a presetsecond warning prompt if the circuit control command is generated, wherethe second warning prompt includes at least one prompt mode. Forexample, the prompt mode may include one or more of a sound prompt mode,a flicker prompt mode, and an oscillation prompt mode, and the promptmode in the second warning prompt is not limited to these prompt modes.The circuit control command may be a command for keeping charging ordisconnecting from charging, and therefore the user terminal may setdifferent prompt modes for different commands. In this way, the user isprompted in the prompt mode, so that the user can learn of a currentcharging status in time.

According to a tenth aspect, an embodiment of the present inventionprovides another user terminal, the user terminal includes a processor,a charging control IC, and a transceiver, and the processor isconfigured to execute the charging method provided in the fifth aspectof the present invention. Optionally, the user terminal may furtherinclude a memory, a display system, an audio frequency system, and/or anoscillator; the memory is configured to store application program codeused for supporting a user terminal in executing the foregoing method;and the processor is configured to execute an application program storedin the memory.

According to an eleventh aspect, an embodiment of the present inventionprovides a computer storage medium, configured to store a computersoftware instruction used by the charge protection apparatus. Thecomputer software instruction includes a program that is designed forexecuting the foregoing aspects.

According to a twelfth aspect, an embodiment of the present inventionprovides a computer storage medium, configured to store a computersoftware instruction used by the user terminal. The computer softwareinstruction includes a program that is designed for executing theforegoing aspects.

In the embodiments of the present invention, names of the charging datacable and the user terminal impose no limitation on the devices. In anactual application, these devices may have other names, provided thatfunctions of the devices are similar to those in the present inventionand fall within the scope defined by the following claims and equivalenttechnologies of the present invention.

In the embodiments of the present invention, a charging current ismonitored in real time, so that the user terminal monitors whether aleakage current exists in the current charging process, and in a case ofthe leakage current, the power cable is disconnected from charging intime by using the charge protection apparatus, so as to protect the userterminal.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the embodiments of the presentinvention or in the prior art more clearly, the following brieflydescribes the accompanying drawings required for describing theembodiments. Apparently, the accompanying drawings in the followingdescription show merely some embodiments of the present invention, and aperson of ordinary skill in the art may still derive other drawings fromthese accompanying drawings without creative efforts.

FIG. 1 is a possible schematic diagram of charging;

FIG. 2 is a schematic structural diagram of a charge protectionapparatus according to an embodiment of the present invention;

FIG. 3 a is an example diagram of charging according to an embodiment ofthe present invention;

FIG. 3 b is another example diagram of charging according to anembodiment of the present invention;

FIG. 4 is a schematic flowchart of a charging method according to anembodiment of the present invention;

FIG. 5 a is an example diagram of a prompt according to an embodiment ofthe present invention;

FIG. 5 b is an example diagram of another prompt according to anembodiment of the present invention;

FIG. 6 is a schematic flowchart of another charging method according toan embodiment of the present invention;

FIG. 7 a is an example diagram of another prompt according to anembodiment of the present invention;

FIG. 7 b is an example diagram of another prompt according to anembodiment of the present invention;

FIG. 8 is a schematic modular diagram of a charge protection apparatusaccording to an embodiment of the present invention;

FIG. 9 is a schematic modular diagram of a user terminal according to anembodiment of the present invention; and

FIG. 10 is a schematic structural diagram of a user terminal accordingto an embodiment of the present invention.

DESCRIPTION OF EMBODIMENTS

In solutions provided in the present invention, a charging current ismonitored in real time, so that a user terminal monitors whether aleakage current exists in a current charging process, and in a case ofthe leakage current, a power cable is disconnected from charging in timeby using a charge protection apparatus, so as to protect the userterminal. To make a person skilled in the art understand the technicalsolutions in the present invention better, the following clearlydescribes the technical solutions in the embodiments of the presentinvention with reference to the accompanying drawings in the embodimentsof the present invention. Apparently, the described embodiments aremerely some rather than all of the embodiments of the present invention.All other embodiments obtained by a person of ordinary skill in the artbased on the embodiments of the present invention without creativeefforts shall fall within the protection scope of the present invention.

In the specification, claims, and accompanying drawings of the presentinvention, the terms “first”, “second”, “third”, “fourth”, and the likeare intended to distinguish between different objects but do notindicate a particular order. Moreover, the terms “include”, “contain”,and any other variant thereof are intended to cover a non-exclusiveinclusion. For example, a process, a method, a system, a product, or adevice that includes a series of steps or units is not limited to thelisted steps or units, but optionally further includes an unlisted stepor unit, or optionally further includes another inherent step or unit ofthe process, the method, the product, or the device.

“Embodiment” mentioned in this specification indicates that a particularcharacteristic, structure, or property that is related to the embodimentmay be included in at least one embodiment of the present invention. Theword occurring at different locations in this specification does notnecessarily refer to a same embodiment, or an independent or alternateembodiment exclusive of another embodiment. A person skilled in the artunderstands, in explicit and implicit manners, that an embodimentdescribed in this specification may be combined with another embodiment.

For ease of understanding the present invention, the following firstdescribes an example diagram of existing charging. As shown in FIG. 1 ,to charge a user terminal, there may be a charger, a charging datacable, and the user terminal. In one manner, the charging data cable andthe charger may be integrated together. In another manner, one end ofthe charging data cable and the charger may be connected by using a USBport. The charging data cable has a USB port at the other end of thecharging data cable, and is connected to a charging port of the userterminal by using the USB port. In this way, the charging data cable isconnected to the user terminal. The charging data cable further includesa charging cable. The charging cable may include a power cable, a datacable, and a ground cable. The data cable may include a positive datacable (Data+, D+) and a negative data cable (Data−, D−). If the chargingdata cable and the charger are integrated together, when the charger isconnected to a power supply apparatus and the USB port at the other endof the charging data cable is connected to the user terminal, a functionfor charging the user terminal can be implemented. Alternatively, if thecharging data cable and the user terminal are connected by using the USBport, a function for charging the user terminal can be implemented in amanner in which one end of the charging data cable is connected to apower supply apparatus, and the other end is connected to the userterminal, instead of using the charger. The power cable is used forcharging, and if the power supply apparatus can further exchange datawith the user terminal, data transmission can be implemented by usingthe data cable.

However, in an actual application, in a process in which the powersupply apparatus charges the user terminal by using the charging datacable, a current flowing through the charging port is short-circuited toground, and consequently the charging port is burned. In the embodimentsof the present invention, a charge protection apparatus is provided. Thecharge protection apparatus includes a micro control unit (Micro ControlUnit, MCU), a current detection circuit, a gating circuit, and aninput/output (input/output, I/O) interface. The current detectioncircuit and the gating circuit are disposed on a power cable. In acharging process, if the gating circuit is in a closed state, the powercable remains in a charging connection; or if the gating circuit is inan open state, the power cable is disconnected from charging. The I/Ointerface and the data cable are connected, and the MCU sends data byusing the I/O interface. The current detection circuit detects anexternal charging current flowing through the power cable. The currentdetection circuit transmits the external charging current to the MCU.The MCU transmits the external charging current to a user terminal byusing the I/O interface, so that the user terminal calculates a currentdifference between the external charging current and an internalcharging current detected by the user terminal, and determines, based onthe current difference, whether to generate a circuit control command.The MCU receives the circuit control command sent by the user terminal,and controls, according to the circuit control command, the gatingcircuit to be in the closed state or the open state. A charging currentis monitored in real time, so that the user terminal monitors whether aleakage current exists in a current charging process, and in a case ofthe leakage current, the power cable is disconnected from charging intime by using the charge protection apparatus, so as to protect the userterminal.

The USB port in the embodiments of the present invention may be a type-AUSB port, a type-B USB port, a mini USB port, a micro USB port, or alightning USB port. For example, if a USB port at one end of a chargingdata cable is a type-A male USB port, in one manner, the USB port isdirectly connected to a type-A female USB port of a power supplyapparatus; in another manner, the USB port is connected to a type-A USBport disposed in a charger, and the charger is inserted into a powersource socket to implement a connection between the USB port and a powersource. A USB port at the other end of the charging data cable is amicro male USB port, and may be connected to a micro female USB port: acharging port of a user terminal, to implement a function for chargingthe user terminal. It may be understood that, although a port used forthe charging data cable is a USB port currently, in the embodiments ofthe present invention, any transmission port for implementing electricalsignal transmission and/or data signal transmission can be used for thecharging data cable.

In the embodiments of the present invention, the user terminal may beany device that needs to be charged by using a charging port, such as atablet computer, a mobile phone, a personal computer (Personal Computer,PC), a notebook computer, an in-vehicle device, a smart band, asmartwatch, or smart glasses.

Referring to FIG. 2 , FIG. 2 is a schematic structural diagram of acharge protection apparatus according to an embodiment of the presentinvention. As shown in FIG. 2 , the charge protection apparatus 1 isconnected to a charging cable 2. The charging cable 2 includes a powercable 201 and a data cable 202. Optionally, the charging cable 2includes a ground cable 203. The charge protection apparatus 1 includesa micro control unit 101, a current detection circuit 102, a gatingcircuit 103, an I/O interface 105, and a bus 112. Optionally, the chargeprotection apparatus 1 further includes a port status detection circuit104. Optionally, the charge protection apparatus 1 further includes avoltage detection circuit 106 and/or a temperature detection circuit107. Optionally, the charge protection apparatus 1 may further include aprompt circuit 108, a buzzer 109, an indicator 110, and an oscillator111.

The current detection circuit 102 and the gating circuit 103 aredisposed on the power cable 201. In a charging process, if the gatingcircuit 103 is in a closed state, the power cable 201 remains in acharging connection; or if the gating circuit 103 is in an open state,the power cable 201 is disconnected from charging. The I/O interface 105and the data cable 202 are connected. The MCU 101 sends data by usingthe I/O interface 105.

The bus 112 may include a channel, used to transmit information betweenthe components included in the charge protection apparatus 1.

The current detection circuit 102 detects an external charging currentflowing through the power cable 201. The current detection circuit 102transmits the external charging current to the MCU 101. The MCU 101transmits the external charging current to a user terminal by using theI/O interface 105, so that the user terminal calculates a currentdifference between the external charging current and an internalcharging current detected by the user terminal, and determines, based onthe current difference, whether to generate a circuit control command.Content about this part is described in the following embodiment. TheMCU 101 receives the circuit control command sent by the user terminal,and controls, according to the circuit control command, the gatingcircuit 103 to be in the closed state or the open state. In this way, acharging current of the charge protection apparatus can be monitored inreal time, so that the user terminal monitors whether a leakage currentexists in the current charging process, and in a case of the leakagecurrent, the power cable is disconnected from charging in time by usingthe charge protection apparatus, so as to protect the user terminal.

If the circuit control command is to keep charging, the MCU 101 controlsthe gating circuit 103 to be in the closed state, so that the powercable 201 remains in the charging connection; or if the circuit controlcommand is to disconnect from charging, the MCU 101 controls the gatingcircuit 103 to be in the open state, so that the power cable isdisconnected from charging.

Optionally, the charge protection apparatus further includes the portstatus detection circuit 104. The port status detection circuit 104 andthe gating circuit 103 are connected in parallel. When the gatingcircuit 103 is in the open state, if the port status detection circuit104 detects that the gating circuit 103 is disconnected from the powersupply apparatus or is disconnected from a charging port of the userterminal, the port status detection circuit 104 notifies the MCU 101that the port connection has been broken, and the MCU 101 controls thegating circuit 103 to be in the closed state.

For example, the port status detection circuit 104 may include a currentlimiting resistor and a micro current detection circuit. Because theport status detection circuit 104 and the gating circuit 103 areconnected in parallel, the port status detection circuit is equivalentto another closed circuit on the power cable. However, herein, setting aresistance value of the current limiting resistor can enable a currentof the closed circuit to be at a milliampere scale or even smaller, andthe current can be detected by using the micro current detectioncircuit. During specific implementation, if the micro current detectioncircuit detects a current greater than 0 in the closed circuit, itindicates that the user terminal is not disconnected from the powersupply apparatus, and is not disconnected from the charging port of theuser terminal, either. In this case, a connected state of the gatingcircuit 103 is not changed. If the micro current detection circuitdetects a current 0 in the closed circuit, it indicates that the gatingcircuit 103 is disconnected from the power supply apparatus and is alsodisconnected from the charging port of the user terminal, and it furtherindicates that the user terminal is currently not charged. Therefore, onthis premise, once the gating circuit 103 is in the open state, the portstatus detection circuit 104 notifies the MCU 101 that the gatingcircuit 103 is disconnected from the charging port, so that the MCU 101controls the gating circuit 103 to restore to the closed state, helpingthe charge protection apparatus perform protection for a next chargingconnection.

For example, the MCU 101 may control, by using a high level signal, thegating circuit 103 to be in the closed state, and control, by using alow level signal, the gating circuit 103 to be in the open state.Specifically, the MCU 101 may send, to the gating circuit 103, a firstdigital signal indicating the high level signal, and the gating circuit103 generates the high level signal through digital-analog conversionafter receiving the first digital signal. The high level signal is usedto control the gating circuit 103 to be in the closed state. Likewise,the MCU 101 may send, to the gating circuit 103, a second digital signalindicating the low level signal, and the gating circuit 103 generatesthe low level signal through digital-analog conversion after receivingthe second digital signal. The low level signal is used to control thegating circuit 103 to be in the open state.

For another example, referring to FIG. 3 a , FIG. 3 a is an examplediagram of charging according to an embodiment of the present invention.As shown in FIG. 3 a , one end of a charging data cable is connected toa charger, and the other end is connected to a charging port of a userterminal. The charging data cable includes a charge protectionapparatus. A charging cable connected to the charge protection apparatusis a cable in the charging data cable. In the user terminal, thecharging port is connected to a charging control integrated circuit(integrated circuit, IC), and the charging control IC is connected to abattery of the user terminal. After the charger is connected to a powersource, the user terminal can be charged by using the charging datacable. In a charging process, the charging data cable may detect anexternal charging current by using the charge protection apparatus. Thecharging control IC of the user terminal can detect an internal chargingcurrent of the user terminal. The user terminal compares the externalcharging current and the internal charging current, to detect whether aleakage current exists. Specifically, if a current difference betweenthe external charging current and the internal charging current is lessthan a first current threshold (for example, the first current thresholdis 5 milliampere or 1 milliampere), it may be considered that thebattery of the user terminal is in a normal charging state, and noleakage current exists in the current charging process. If the currentdifference between the external charging current and the internalcharging current is greater than the first current threshold, a leakagecurrent exists in the current charging process. Some of currents flowingfrom the charging data cable to the charging port of the user terminalmay flow into the charging control IC, and some of the currents may flowinto a ground cable of the charging port. If there is an extremely highcurrent in the ground cable of the charging port, the charging port maybe burned due to overheating. Therefore, in this embodiment of thepresent invention, the charging data cable may receive a circuit controlcommand that is generated by the user terminal based on a result ofcomparison between the internal charging current and the externalcharging current, and further control whether a power cable isdisconnected from charging, so as to protect the user terminal. Thecharge protection apparatus is usually disposed near the port of theuser terminal on the charging data cable.

For another example, referring to FIG. 3 b , FIG. 3 b is another examplediagram of charging according to an embodiment of the present invention.One end of a charging data cable is connected to a charger, and theother end is connected to a charging port of a user terminal. Thecharger includes a charge protection apparatus. The charger has a powercable and a ground cable. Therefore, when the charging data cable isconnected to the charger, a power cable of the charging data cable isconnected to the power cable of the charger. Then a data cable isdisposed in the charger to connect to an I/O interface of the chargeprotection apparatus. The data cable may be connected to a data cable inthe charging data cable when the charging data cable is connected to thecharger. In the user terminal, the charging port is connected to acharging control IC, and the charging control IC is connected to abattery of the user terminal. After the charger is connected to a powersource, the user terminal can be charged by using the charging datacable. In a charging process, the charging data cable can detect anexternal charging current by using the charge protection apparatus, andthe charging control IC of the user terminal can detect an internalcharging current of the user terminal. The user terminal compares theexternal charging current and the internal charging current, to detectwhether a leakage current exists. Therefore, in this embodiment of thepresent invention, the charger may receive a circuit control commandthat is generated by the user terminal based on a result of comparisonbetween the internal charging current and the external charging current,and further control whether the power cable is disconnected fromcharging, so as to protect the user terminal.

In a first feasible embodiment, based on the foregoing description, thecharge protection apparatus 1 further includes the prompt circuit 108,the buzzer 109, the indicator 110, and the oscillator 111. Duringspecific implementation, if the circuit control command further includesa first warning prompt, the MCU 101 performs a warning operationaccording to the first warning prompt by using the prompt circuit 108.The prompt circuit is configured to control whether the buzzer rings,control whether the indicator flickers, and/or control whether theoscillator oscillates.

Optionally, the charge protection apparatus may include one or more ofthe buzzer 109, the indicator 110, and the oscillator 111. It may beunderstood that, if the buzzer 109 is included, the first warning promptmay include a prompt mode in which the buzzer 109 rings; if theindicator 110 is included, the first warning prompt may include a promptmode in which the indicator 110 flickers; or if the oscillator 111 isincluded, the first warning prompt may include a prompt mode in whichthe oscillator oscillates.

Further, optionally, a first time interval for ringing of the buzzer109, a second time interval for flickering of the indicator 110, and/ora third time interval for oscillation of the oscillator 111 are/is setin the first warning prompt. In this case, that the MCU 101 controls,according to the first warning prompt by using the prompt circuit 108,the buzzer 109 to ring, controls the indicator 110 to flicker, and/orcontrols the oscillator 111 to oscillate is specifically: by using theprompt circuit 108, controlling the buzzer 109 to ring based on thefirst time interval, controlling the indicator 110 to flicker based onthe second time interval, and/or controlling the oscillator 111 tooscillate based on the third time interval.

Further, for example, if the charge protection apparatus includes theindicator 110 and the oscillator 111, the first warning prompt mayinclude only the prompt mode in which the indicator 110 flickers, orinclude only the prompt mode in which the oscillator 111 oscillates, orinclude the prompt mode in which the indicator 110 flickers and theprompt mode in which the oscillator 111 oscillates. Therefore, when thefirst warning prompt may include a plurality of prompt modes, one ormore of the prompt modes may be selected for prompting. This is notlimited in this embodiment of the present invention. In this way, a useris prompted in the prompt mode, so that the user can learn of a currentcharging status in time.

Optionally, in the example diagram of charging shown in FIG. 3 a , theoscillator 111 may not be disposed in the charge protection apparatus 1,so as to reduce space occupied by the charge protection apparatus 1.

It should be noted that, in this embodiment of the present invention,the buzzer, the indicator, and the oscillator are set based on the timeinterval, or the buzzer, the indicator, and the oscillator may be set ina manner, for example, by using a timer, or based on a quantity ofringing times/a quantity of flickering times/a quantity of oscillationtimes, or based on different ringtone content/different indicatorcolors/different oscillation levels. The setting may be performed by amanufacturer or an end user. This is not limited in this embodiment ofthe present invention.

For example, if the MCU 101 receives the first warning prompt and thecircuit control command for keeping charging that are sent by the userterminal, the MCU 101 sends an instruction that the gating circuit 103is to remain in the closed state to the gating circuit 103, and sends,to the prompt circuit 108, an instruction that the buzzer 109 is to ringat intervals of 10s and an instruction that the indicator 110 is toflicker in green at a low speed. If the MCU 101 receives the firstwarning prompt and the circuit control command for disconnecting fromcharging that are sent by the user terminal, the MCU 101 sends aninstruction that the gating circuit 103 is to switch to the open stateto the gating circuit 103, and sends, to the prompt circuit 108, aninstruction that the buzzer 109 is to constantly ring and an instructionthat the indicator 110 is to flicker in red at a high speed. If the MCU101 has not received the circuit control command sent by the userterminal, the MCU 101 does not send an instruction to the gating circuit103, and the buzzer 109 and the indicator 110 may remain in a defaultstate (for example, the default state is a state in which the buzzer 109does not ring and the indicator 110 does not flicker and is in an offstate).

In a second feasible embodiment, if the charge protection apparatus 1does not include the prompt circuit 108, the buzzer 109, the indicator110, or the oscillator 111, or if the charge protection apparatus 1includes the prompt circuit 108, the buzzer 109, the indicator 110, andthe oscillator 111, the charge protection apparatus 1 further includesthe temperature detection circuit 107. The temperature detection circuit107 is configured to detect a temperature of the charging cable.

Specifically, the temperature detection circuit 107 transmits thedetected temperature of the charging cable to the user terminal, so thatthe user terminal determines, based on the temperature of the chargingcable, whether to generate the circuit control command. The MCU 101receives the circuit control command sent by the user terminal, andcontrols, according to the circuit control command, the gating circuit103 to be in the closed state or the open state.

If the circuit control command is to keep charging, the MCU 101 controlsthe gating circuit 103 to be in the closed state; or if the circuitcontrol command is to disconnect from charging, the MCU 101 controls thegating circuit 103 to be in the open state.

Optionally, in the example diagram of charging shown in FIG. 3 a , thecharge protection apparatus 1 may be disposed at a position close to aUSB port connected to the charging port of the user terminal, so thatthe temperature detection circuit 107 can more accurately detect atemperature around the charging port, so as to better protect the userterminal. A plurality of temperature detection circuits 107 may bedisposed.

Optionally, in the example diagram of charging shown in FIG. 3 b , amodule other than the temperature detection circuit 107 in the chargeprotection apparatus 1 may be disposed in the charger, and thetemperature detection circuit 107 may be independently disposed at aposition close to a USB port connected to the charging port of the userterminal on the charging data cable, so that the temperature detectioncircuit 107 can more accurately detect a temperature around the chargingport, so as to better protect the user terminal.

Further, if the charge protection apparatus 1 further includes theprompt circuit 108, the buzzer 109, the indicator 110, and theoscillator 111, the MCU 101 may further receive the circuit controlcommand that carries the first warning prompt and that is sent by theuser terminal, and the MCU 101 performs a warning operation according tothe first warning prompt by using the prompt circuit 108.

It should be noted that, for the first warning prompt herein, refer tothe first warning prompt described in the first feasible embodiment.Details are not described herein again.

In a third feasible embodiment, based on the foregoing feasibleembodiments, the charge protection apparatus 1 further includes thevoltage detection circuit 106, and the voltage detection circuit 106 isdisposed on the power cable.

Specifically, the voltage detection circuit 106 detects an externalcharging voltage of the power cable, and the voltage detection circuit106 transmits the external charging voltage to the MCU 101. The MCU 101transmits the external charging voltage to the user terminal by usingthe I/O interface 105, so that the user terminal determines, based onthe external charging voltage, whether to generate the circuit controlcommand. The MCU 101 receives the circuit control command sent by theuser terminal, and controls, according to the circuit control command,the gating circuit 103 to be in the closed state or the open state.

If the circuit control command is to keep charging, the MCU 101 controlsthe gating circuit 103 to be in the closed state; or if the circuitcontrol command is to disconnect from charging, the MCU 101 controls thegating circuit 103 to be in the open state.

In this embodiment of the present invention, the charging current, thecharging voltage, and the temperature of the charging cable aremonitored in real time, so that the user terminal monitors whether aleakage current exists in the current charging process, whether acharging voltage is extremely high, and whether a temperature isextremely high, and in a case of the leakage current, the extremely highvoltage, or the extremely high temperature, the power cable isdisconnected in time by using the charge protection apparatus, so as toprotect the user terminal. In addition, through triple detection of thecharging current, the charging voltage, and the temperature of thecharging cable, the user terminal can be better protected in thecharging process.

Referring to FIG. 4 , FIG. 4 is a schematic flowchart of a chargingmethod according to an embodiment of the present invention. Theembodiment shown in FIG. 4 is described from two perspectives of acharge protection apparatus and a user terminal. For the chargeprotection apparatus, refer to the charge protection apparatus in theembodiment shown in FIG. 2 . In the embodiment shown in FIG. 4 , thecharge protection apparatus may be disposed in a charger or a chargingdata cable. Therefore, the charge protection apparatus is connected to apower supply apparatus by using the charger or the charging data cable.A USB port of the charging data cable is connected to a charging port ofthe user terminal. The method may include step 101 to step 107.

101. The charge protection apparatus detects an external chargingcurrent flowing through a power cable.

Specifically, the charge protection apparatus detects, by using acurrent detection circuit, the external charging current flowing throughthe power cable. It may be understood that, in a process of charging theuser terminal, a current of the power supply apparatus is transmittedfrom the charge protection apparatus to the user terminal, and thereforethe current first flows through the charge protection apparatus, andthen is transmitted to the user terminal. Therefore, in this embodimentof the present invention, the external charging current and an internalcharging current may be compared, to determine whether a leakage currentexists in the current charging process.

102. The charge protection apparatus sends the external charging currentto the user terminal.

Specifically, the charge protection apparatus sends the externalcharging current to the user terminal by using a data cable, andcorrespondingly, the user terminal receives the external chargingcurrent sent by the charge protection apparatus, so that the userterminal monitors the external charging current in the current chargingprocess.

103. The user terminal detects an internal charging current.

Optionally, a charging control IC is disposed inside the user terminal,and the charging control IC is configured to detect the internalcharging current flowing through a battery of the user terminal.

In a feasible solution, the user terminal may determine whether theinternal charging current is greater than a fourth current threshold.The fourth current threshold is a maximum charging current that the userterminal can tolerate. If the internal charging current is less than orequal to the fourth current threshold, the user terminal performs step104. If the internal charging current is greater than the fourth currentthreshold, in one solution, the user terminal proceeds to perform step104, to detect whether a leakage current exists, and the user terminalperforms a current limiting operation by using the charging control IC,so that the internal charging current is reduced to a value less than orequal to the fourth current threshold; in another solution, the userterminal does not perform step 104, but directly generates a circuitcontrol command for disconnecting from charging, and performs step 106to send the circuit control command to the charge protection apparatus,so that after the charge protection apparatus receives the circuitcontrol command for disconnecting from charging, the power cable isdisconnected by using the charge protection apparatus, so as to protectthe user terminal.

104. The user terminal calculates a current difference between theexternal charging current and the internal charging current.

Specifically, the user terminal calculates the current differencebetween the external charging current detected by the charge protectionapparatus and the internal charging current detected by the userterminal. The current difference may be used to detect whether a leakagecurrent exists in the current charging process. If no leakage currentexists, the current difference between the external charging current andthe internal charging current is less than a first current threshold(for example, the first current threshold is 5 milliampere or 1milliampere). If the current difference between the external chargingcurrent and the internal charging current is greater than the firstcurrent threshold, it indicates that a leakage current exists in thecurrent charging process.

105. The user terminal determines, based on the current difference,whether to generate a circuit control command.

Specifically, if the current difference is greater than the firstcurrent threshold and less than a second current threshold, the userterminal determines that the generated circuit control command is tokeep charging; or if the current difference is greater than the secondcurrent threshold and less than a third current threshold, the userterminal determines that the generated circuit control command is todisconnect from charging. It may be understood that, if the currentdifference is less than the first current threshold, the user terminaldoes not generate the circuit control command. The first currentthreshold, the second current threshold, and the third current thresholdare real numbers greater than or equal to 0.

It should be noted that, in this embodiment of the present invention,based on the first current threshold, the second current threshold, andthe third current threshold, there are three cases about whether togenerate the circuit control command. Cases in which the currentdifference is equal to the first current threshold, the second currentthreshold, and the third current threshold may be respectively added toclassifications in which the first current threshold, the second currentthreshold, and the third current threshold are respectively used ascritical values, and a case in which the current difference is equal toone threshold cannot be added to different classifications. For example,the case in which the current difference is equal to the second currentthreshold may be added to a solution in which if the current differenceis greater than the first current threshold and less than or equal tothe second current threshold, it is determined that the generatedcircuit control command is to keep charging; or the case in which thecurrent difference is equal to the second current threshold may be addedto a solution in which if the current difference is greater than orequal to the second current threshold and less than the third currentthreshold, it is determined that the generated circuit control commandis to disconnect from charging.

Optionally, if the current difference is greater than the first currentthreshold and less than the second current threshold, the user terminaloutputs a first pop-up prompt on a screen. The first pop-up prompt is aprompt message used to indicate that the current difference exists inthe current charging process. For example, referring to FIG. 5 a , FIG.5 a is an example diagram of a prompt according to an embodiment of thepresent invention. As shown in FIG. 5 a , if the current difference isgreater than the first current threshold and less than the secondcurrent threshold, it indicates that a leakage current with a relativelysmall current exists in the current charging process, and a warningnotice shown in FIG. 5 a may be used to notify a user. The warningnotice can be used to instruct the user to check whether there is aproblem of liquid intake, corrosion, or the like for the charging portof the user terminal, so as to protect the charging port from beingburned.

If the current difference is greater than the second current thresholdand less than the third current threshold, the user terminal outputs asecond pop-up prompt on the screen. The second pop-up prompt is a promptmessage used to indicate that the current difference exists in thecurrent charging process and charging is disconnected. For example,referring to FIG. 5 b , FIG. 5 b is another example diagram of a promptaccording to an embodiment of the present invention. As shown in FIG. 5b , if the current difference is greater than the second currentthreshold and less than the third current threshold, it indicates that aleakage current with a relatively large current exists in the currentcharging process, and a warning notice shown in FIG. 5 b may be used tonotify a user. The warning notice can be used to notify the user thatcharging is disconnected and instruct the user to check in time whetherthere is a problem of liquid intake, corrosion, or the like for thecharging port of the user terminal.

106. The user terminal sends the circuit control command to the chargeprotection apparatus.

Specifically, the user terminal sends the circuit control command to thecharge protection apparatus by using the data cable.

Correspondingly, the charge protection apparatus receives the circuitcontrol command sent by the user terminal. It may be understood that, ifthe circuit control command sent by the user terminal is not received,the charge protection apparatus remains in a charging state, and in thiscase, the power cable remains in a charging connection.

107. The charge protection apparatus controls, according to the circuitcontrol command, whether the power cable is disconnected from charging.

Specifically, in the process of charging the user terminal, if thereceived circuit control command is to keep charging, the chargeprotection apparatus controls the power cable to remain in the chargingconnection; or if the received circuit control command is to disconnectfrom charging, the charge protection apparatus controls the power cableto disconnect from charging. The charge protection apparatus may controla gating circuit to remain in a closed state, so that the power cableremains in the charging connection; or the charge protection apparatusmay control the gating circuit to switch to an open state, so that thepower cable is disconnected from charging.

In a feasible solution, if the circuit control command carries a firstwarning prompt, the charge protection apparatus performs a warningoperation according to the first warning prompt. Optionally, the firstwarning prompt carries at least one prompt mode and a time interval forexecuting each prompt mode, and therefore the charge protectionapparatus performs, based on the time interval for each prompt mode, anoperation corresponding to each prompt mode. Optionally, in thisembodiment of the present invention, the prompt mode may include but isnot limited to at least one of a mode in which a buzzer rings, a mode inwhich an indicator flickers, and a mode in which an oscillatoroscillates. It should be noted that, in this embodiment of the presentinvention, the buzzer, the indicator, and the oscillator are set basedon the time interval, or the buzzer, the indicator, and the oscillatormay be set in a manner, for example, by using a timer, or based on aquantity of ringing times/a quantity of flickering times/a quantity ofoscillation times, or based on different ringtone content/differentindicator colors/different oscillation levels. The setting may beperformed by a manufacturer or an end user. This is not limited in thisembodiment of the present invention.

In this embodiment of the present invention, a charging current ismonitored in real time, so that the user terminal monitors whether aleakage current exists in the current charging process, and in a case ofthe leakage current, the power cable is disconnected in time by usingthe charge protection apparatus, so as to protect the user terminal.

Referring to FIG. 6 , FIG. 6 is a schematic flowchart of a chargingmethod according to an embodiment of the present invention. Theembodiment shown in FIG. 6 is described from two perspectives of acharge protection apparatus and a user terminal. For the chargeprotection apparatus, refer to the charge protection apparatus in theembodiment shown in FIG. 2 . In the embodiment shown in FIG. 6 , thecharge protection apparatus may be disposed in a charger or a chargingdata cable. Therefore, the charge protection apparatus is connected to apower supply apparatus by using the charger or the charging data cable.A USB port of the charging data cable is connected to a charging port ofthe user terminal. The method may include step 201 to step 213.

201. The charge protection apparatus detects an external chargingcurrent flowing through a power cable.

Specifically, the charge protection apparatus detects, by using acurrent detection circuit, the external charging current flowing throughthe power cable. It may be understood that, in a process of charging theuser terminal, a current of the power supply apparatus is transmittedfrom the charge protection apparatus to the user terminal, and thereforethe current first flows through the charge protection apparatus, andthen is transmitted to the user terminal. Therefore, in this embodimentof the present invention, the external charging current and an internalcharging current may be compared, to determine whether a leakage currentexists in the current charging process.

202. The charge protection apparatus sends the external charging currentto the user terminal.

Specifically, the charge protection apparatus sends the externalcharging current to the user terminal by using a data cable, andcorrespondingly, the user terminal receives the external chargingcurrent sent by the charge protection apparatus, so that the userterminal learns of the external charging current in the current chargingprocess.

203. The user terminal detects an internal charging current.

Optionally, a charging control IC is disposed inside the user terminal,and the charging control IC is configured to detect the internalcharging current flowing through a battery of the user terminal.

204. The user terminal calculates a current difference between theexternal charging current and the internal charging current.

205. The user terminal determines, based on the current difference,whether to generate a circuit control command.

206. The charge protection apparatus receives the circuit controlcommand sent by the user terminal.

207. The charge protection apparatus controls, according to the circuitcontrol command, whether the power cable is disconnected from charging.

For step 203 to step 207, refer to detailed descriptions ofcorresponding steps in the embodiment shown in FIG. 4 . Details are notdescribed herein again.

208. The charge protection apparatus detects a temperature of a chargingcable.

Specifically, the charge protection apparatus detects the temperature ofthe charging cable by using a built-in temperature detection circuit. Inthe process of charging the user terminal, an extremely high temperatureat the charging port may cause the charging port and the chargeprotection apparatus to be burned. Therefore, if the temperaturedetection circuit is at a position close to the USB port connected tothe charging port of the user terminal, the temperature detectioncircuit can more accurately detect a temperature around the chargingport, thereby improving detection accuracy.

Optionally, the charge protection apparatus may detect the externalcharging current and the temperature of the charging cable concurrently,and therefore step 201 and step 208 are performed in no particularorder.

209. The charge protection apparatus sends the temperature of thecharging cable to the user terminal.

Specifically, the charge protection apparatus sends the temperature ofthe charging cable to the user terminal by using the data cable, andcorrespondingly, the user terminal receives the temperature of thecharging cable that is sent by the charge protection apparatus, so thatthe user terminal learns of the temperature of the charging cable in thecurrent charging process.

210. The user terminal determines, based on the temperature of thecharging cable, whether to generate the circuit control command.

Specifically, if the temperature of the charging cable is greater than afirst temperature threshold and less than a second temperaturethreshold, the user terminal determines that the generated circuitcontrol command is to keep charging; or if the temperature of thecharging cable is greater than the second temperature threshold, theuser terminal determines that the generated circuit control command isto disconnect from charging. It may be understood that, if thetemperature of the charging cable is less than the first temperaturethreshold, the user terminal does not generate the circuit controlcommand. The first temperature threshold, the second temperaturethreshold, and a third temperature threshold are real numbers greaterthan or equal to 0.

It should be noted that, in this embodiment of the present invention,based on the first temperature threshold, the second temperaturethreshold, and the third temperature threshold, there are three casesabout whether to generate the circuit control command. Cases in whichthe temperature of the charging cable is equal to the first temperaturethreshold, the second temperature threshold, and the third temperaturethreshold may be respectively added to classifications in which thefirst temperature threshold, the second temperature threshold, and thethird temperature threshold are respectively used as critical values,and a case in which the temperature of the charging cable is equal toone threshold cannot be added to different classifications. For example,the case in which the temperature of the charging cable is equal to thesecond temperature threshold may be added to a solution in which if thetemperature of the charging cable is greater than the first temperaturethreshold and less than or equal to the second temperature threshold, itis determined that the generated circuit control command is to keepcharging; or the case in which the temperature of the charging cable isequal to the second temperature threshold may be added to a solution inwhich if the temperature of the charging cable is greater than or equalto the second temperature threshold and less than the third temperaturethreshold, it is determined that the generated circuit control commandis to disconnect from charging.

Optionally, if the temperature of the charging cable is greater than thefirst temperature threshold and less than the second temperaturethreshold, the user terminal outputs a third pop-up prompt on a screen.The third pop-up prompt is a prompt message used to indicate that thetemperature of the charging cable is extremely high in the currentcharging process. For example, referring to FIG. 7 a , FIG. 7 a isanother example diagram of a prompt according to an embodiment of thepresent invention. As shown in FIG. 7 a , if the temperature of thecharging cable is greater than the first temperature threshold and lessthan the second temperature threshold, it indicates that continuousheating may occur due to a short circuit in the current chargingprocess, and a warning notice shown in FIG. 7 a may be used to notify auser. The warning notice can be used to instruct the user to checkwhether there is any exception in a connection between a second USB portof the charge protection apparatus and the charging port of the userterminal, so as to protect the charging port from being burned due tocontinuous heating.

If the temperature of the charging cable is greater than the secondtemperature threshold and less than the third temperature threshold, theuser terminal outputs a fourth pop-up prompt on the screen. The fourthpop-up prompt is a prompt message used to indicate that the temperatureof the charging cable is extremely high in the current charging processand charging is disconnected. For example, referring to FIG. 7 b , FIG.7 b is another example diagram of a prompt according to an embodiment ofthe present invention. As shown in FIG. 7 b , if the temperature of thecharging cable is greater than the second temperature threshold and lessthan the third temperature threshold, it indicates that a temperature isextremely high in the current charging process, and a warning noticeshown in FIG. 7 b may be used to notify a user. The warning notice canbe used to notify the user that charging is disconnected and instructthe user to check in time whether there is any exception in a connectionbetween a second USB port of the charge protection apparatus and thecharging port of the user terminal.

After step 210, if the user terminal determines to generate the circuitcontrol command, the following steps are performed: step 206 of sendingthe circuit control command to the charge protection apparatus and step207 of controlling, according to the circuit control command, whetherthe power cable is disconnected from charging. For details, refer todetailed descriptions of corresponding steps in the embodiment shown inFIG. 4 . Details are not described herein again.

211. The charge protection apparatus detects an external chargingvoltage of the power cable.

Specifically, the charge protection apparatus detects the externalcharging voltage of the power cable by using a built-in voltagedetection circuit.

Optionally, the charge protection apparatus may detect the externalcharging current, the temperature of the charging cable, and theexternal charging voltage of the power cable concurrently, and thereforestep 201, step 208, and step 211 are performed in no particular order.

212. The charge protection apparatus sends the external charging voltageto the user terminal.

Specifically, the charge protection apparatus sends the externalcharging voltage to the user terminal by using the data cable, andcorrespondingly, the user terminal receives the external chargingvoltage sent by the charge protection apparatus, so that the userterminal learns of the external charging voltage in the current chargingprocess.

213. The user terminal determines, based on the external chargingvoltage of the power cable, whether to generate the circuit controlcommand.

Specifically, if the external charging voltage of the power cable isgreater than a first voltage threshold and less than a second voltagethreshold, the user terminal determines that the generated circuitcontrol command is to keep charging; or if the external charging voltageof the power cable is greater than the second voltage threshold, theuser terminal determines that the generated circuit control command isto disconnect from charging. It may be understood that, if the externalcharging voltage of the power cable is less than the first voltagethreshold, the user terminal does not generate the circuit controlcommand. The first voltage threshold, the second voltage threshold, anda third voltage threshold are real numbers greater than or equal to 0.

It should be noted that, in this embodiment of the present invention,based on the first voltage threshold, the second voltage threshold, andthe third voltage threshold, there are three cases about whether togenerate the circuit control command. Cases in which the externalcharging voltage of the power cable is equal to the first voltagethreshold, the second voltage threshold, and the third voltage thresholdmay be respectively added to classifications in which the first voltagethreshold, the second voltage threshold, and the third voltage thresholdare respectively used as critical values, and a case in which theexternal charging voltage of the power cable is equal to one thresholdcannot be added to different classifications. For example, the case inwhich the external charging voltage of the power cable is equal to thesecond voltage threshold may be added to a solution in which if theexternal charging voltage of the power cable is greater than the firstvoltage threshold and less than or equal to the second voltagethreshold, it is determined that the generated circuit control commandis to keep charging; or the case in which the external charging voltageof the power cable is equal to the second voltage threshold may be addedto a solution in which if the external charging voltage of the powercable is greater than or equal to the second voltage threshold and lessthan the third voltage threshold, it is determined that the generatedcircuit control command is to disconnect from charging.

Optionally, if the external charging voltage of the power cable isgreater than the first voltage threshold and less than the secondvoltage threshold, the user terminal outputs a fifth pop-up prompt onthe screen. The fifth pop-up prompt is a prompt message used to indicatethat the external charging voltage of the power cable is extremely highin the current charging process. For example, if the external chargingvoltage of the power cable is greater than the first voltage thresholdand less than the second voltage threshold, it indicates that a chargingvoltage is extremely high in the current charging process, and a warningnotice may be used to notify a user. The warning notice can be used tonotify the user that currently the charging voltage is extremely high,and the user may determine whether the user terminal keeps charging.

If the external charging voltage of the power cable is greater than thesecond voltage threshold and less than the third voltage threshold, theuser terminal outputs a sixth pop-up prompt on the screen. The sixthpop-up prompt is a prompt message used to indicate that the externalcharging voltage of the power cable is extremely high in the currentcharging process and charging is disconnected. For example, if theexternal charging voltage of the power cable is greater than the secondvoltage threshold and less than the third voltage threshold, itindicates that a voltage is extremely high in the current chargingprocess, and a warning notice may be used to notify a user. The warningnotice can be used to notify the user that charging is disconnected andthe charging voltage is extremely high.

After step 213, if the user terminal determines to generate the circuitcontrol command, the following steps are performed: step 206 of sendingthe circuit control command to the charge protection apparatus and step207 of controlling, according to the circuit control command, whetherthe power cable is disconnected from charging. For details, refer todetailed descriptions of corresponding steps in the embodiment shown inFIG. 4 . Details are not described herein again.

Optionally, the user terminal may further output the internal chargingcurrent and the external charging current on the screen.

Optionally, the user terminal may further output the temperature of thecharging cable on the screen.

Optionally, the user terminal may further output the external chargingvoltage on the screen.

It should be noted that, in this embodiment of the present invention,step 208 and step 209 are performed if the temperature detection circuitis built in the charge protection apparatus. Therefore, provided thatthe charge protection apparatus includes the temperature detectioncircuit, the solution of step 208 and step 209 may be executed. If aleakage current exists at the charging port and the charging portremains in a charging state for a long time, the charging cable in thecharge protection apparatus continuously emits heat. A probability thatthe charge protection apparatus is burned can be reduced by detectingthe temperature of the charging cable. Further, if the temperaturedetection circuit is at the position close to the USB port connected tothe charging port of the user terminal, the temperature detectioncircuit can more accurately detect the temperature around the chargingport, thereby improving detection accuracy.

It should also be noted that, in this embodiment of the presentinvention, step 211 and step 212 are performed if the voltage detectioncircuit is built in the charge protection apparatus. Therefore, providedthat the temperature detection circuit is built in the charge protectionapparatus, step 211 and step 212 may be performed.

Optionally, when the power cable is disconnected from charging, if it isdetected that the power cable is disconnected from the power supplyapparatus or is disconnected from the charging port of the userterminal, the charge protection apparatus controls the power cable toestablish a charging connection. In this way, after the power cable isdisconnected from charging, when the charge protection apparatus is notused to charge the user terminal, the power cable is restored to acharging connection state, so that the charge protection apparatusperforms protection for a next charging connection.

Optionally, when the user terminal generates the circuit controlcommand, the user terminal performs a warning operation based on apreset second warning prompt. The second warning prompt includes atleast one prompt mode. For example, the prompt mode may include one ormore of a sound prompt mode, a flicker prompt mode, and an oscillationprompt mode, and the prompt mode in the second warning prompt is notlimited to these prompt modes. The circuit control command may be acommand for keeping charging or disconnecting from charging, andtherefore the user terminal may set different prompt modes for differentcommands. In this way, the user is prompted in the prompt mode, so thatthe user can learn of a current charging status in time.

For example, if the circuit control command is to keep charging, theuser terminal may provide a sound prompt by using a first ringtone. Foranother example, if the circuit control command is to disconnect fromcharging, the user terminal may provide a sound prompt by using a secondringtone and provide an oscillation prompt.

In this embodiment of the present invention, the charging current, thecharging voltage, and the temperature of the charging cable aremonitored in real time, so that the user terminal monitors whether aleakage current exists in the current charging process, whether acharging voltage is extremely high, and whether a temperature isextremely high, and in a case of the leakage current, the extremely highvoltage, or the extremely high temperature, the power cable isdisconnected in time by using the charge protection apparatus, so as toprotect the user terminal. In addition, through triple detection of thecharging current, the charging voltage, and the temperature of thecharging cable, the user terminal can be better protected in thecharging process.

Referring to FIG. 8 , FIG. 8 is a schematic modular diagram of a chargeprotection apparatus according to an embodiment of the presentinvention. As shown in FIG. 8 , the charge protection apparatus 1 inthis embodiment of the present invention may include a detection unit11, a sending unit 12, a receiving unit 13, and a control unit 14.

The control unit 14 is configured to detect an external charging currentof a power cable by using the detection unit 11;

the control unit 14 is further configured to send the external chargingcurrent to a user terminal by using the sending unit 12, so that theuser terminal calculates a current difference between the externalcharging current and an internal charging current detected by the userterminal, and determines, based on the current difference, whether togenerate a circuit control command;

the control unit 14 is further configured to receive, by using thereceiving unit 13, the circuit control command sent by the userterminal; and the control unit 14 is further configured to control,according to the circuit control command, whether the power cable isdisconnected from charging.

In a possible embodiment, the control unit 14 is further configured to:detect a temperature of a charging cable by using the detection unit 11,and send the temperature of the charging cable to the user terminal, sothat the user terminal determines, based on the temperature of thecharging cable, whether to generate the circuit control command.

In a possible embodiment, the control unit 14 is further configured to:detect an external charging voltage of the power cable by using thedetection unit 11, and send the external charging voltage to the userterminal, so that the user terminal determines, based on the externalcharging voltage, whether to generate the circuit control command.

In a possible embodiment, with regard to the controlling, according tothe circuit control command, whether the power cable is disconnectedfrom charging, the control unit 14 is specifically configured to:

if the circuit control command is to keep charging, control the powercable to remain in a charging connection; or if the circuit controlcommand is to disconnect from charging, control the power cable todisconnect from charging.

In a possible embodiment, the control unit 14 is further configured to:if a first warning prompt is set in the circuit control command, performa warning operation according to the first warning prompt.

In a possible embodiment, at least one prompt mode and a time intervalfor executing each prompt mode are set in the first warning prompt; andthe control unit 14 is specifically configured to: if the first warningprompt is set in the circuit control command, perform, based on the timeinterval for each prompt mode, an operation corresponding to each promptmode.

In a possible embodiment, the control unit 14 is further configured to:when the power cable is disconnected from charging, if it is detectedthat the power cable is disconnected from the power supply apparatus oris disconnected from a charging port of the user terminal, control thepower cable to establish a charging connection.

It should be noted that, functions and beneficial effects of functionalunits of the charge protection apparatus 1 described in this embodimentof the present invention may be specifically described according to themethod in the method embodiment shown in FIG. 4 or FIG. 5 . Details arenot described herein again.

In this embodiment, the charge protection apparatus 1 is presented in aform of a functional unit. The “unit” herein may be anapplication-specific integrated circuit (application-specific integratedcircuit, ASIC), a circuit, a processor executing one or more software orfirmware programs, an integrated logic circuit, and/or another componentcapable of providing the foregoing functions. In a simple embodiment, aperson skilled in the art may figure out that the form shown in FIG. 2may be used for the charge protection apparatus 1.

An embodiment of the present invention further provides a computerstorage medium, configured to store a computer software instruction usedby the charge protection apparatus 1 shown in FIG. 8 . The computersoftware instruction includes a program designed for the chargeprotection apparatus 1 to execute the foregoing methods.

Referring to FIG. 9 , FIG. 9 is a schematic modular diagram of a userterminal 2 according to an embodiment of the present invention. As shownin FIG. 9 , the user terminal 2 in this embodiment of the presentinvention may include a detection unit 21, a receiving unit 22, aprocessing unit 23, and a sending unit 24. Optionally, the user terminal2 may further include a first output unit 25, a second output unit 26, athird output unit 27, and/or a fourth output unit 28.

The processing unit 23 is configured to detect an internal chargingcurrent by using the detection unit 21;

the processing unit 23 is further configured to receive, by using thereceiving unit 22, an external charging current sent by the chargeprotection apparatus;

the processing unit 23 is further configured to calculate a currentdifference between the external charging current and the internalcharging current;

the processing unit 23 is further configured to determine, based on thecurrent difference, whether to generate a circuit control command; andthe processing unit 23 is further configured to: if the circuit controlcommand is generated, send the circuit control command to the chargeprotection apparatus by using the sending unit 24.

In a possible embodiment, with regard to the determining, based on thecurrent difference, whether to generate a circuit control command, theprocessing unit 23 is specifically configured to:

if the current difference is greater than a first current threshold andless than a second current threshold, determine that the generatedcircuit control command is to keep charging; or if the currentdifference is greater than the second current threshold and less than athird current threshold, determine that the generated circuit controlcommand is to disconnect from charging.

In a possible embodiment, the user terminal 2 further includes the firstoutput unit 25;

the processing unit 23 is further configured to: if the currentdifference is greater than the first current threshold and less than thesecond current threshold, output a first pop-up prompt on a screen byusing the first output unit 25, where the first pop-up prompt is aprompt message used to indicate that the current difference exists in acurrent charging process; and

the processing unit 23 is further configured to: if the currentdifference is greater than the second current threshold and less thanthe third current threshold, output a second pop-up prompt on the screenby using the first output unit 25, where the second pop-up prompt is aprompt message used to indicate that the current difference exists inthe current charging process and charging is disconnected.

In a possible embodiment, the processing unit 23 is further configuredto receive, by using the receiving unit 22, a temperature of a chargingcable that is sent by the charge protection apparatus; and

the processing unit 23 is further configured to determine, based on thetemperature of the charging cable, whether to generate the circuitcontrol command.

In a possible embodiment, with regard to the determining, based on thetemperature of the charging cable, whether to generate the circuitcontrol command, the processing unit 23 is specifically configured to:

if the temperature of the charging cable is greater than a firsttemperature threshold and less than a second temperature threshold,determine that the generated circuit control command is to keepcharging; or if the temperature of the charging cable is greater thanthe second temperature threshold, determine that the generated circuitcontrol command is to disconnect from charging.

In a possible embodiment, the user terminal 2 further includes thesecond output unit 26;

the processing unit 23 is further configured to: if the temperature ofthe charging cable is greater than the first temperature threshold andless than the second temperature threshold, output a third pop-up prompton the screen by using the second output unit 26, where the third pop-upprompt is a prompt message used to indicate that the temperature of thecharging cable is extremely high in the current charging process; and

the processing unit 23 is further configured to: if the temperature ofthe charging cable is greater than the second temperature threshold andless than the third temperature threshold, output a fourth pop-up prompton the screen by using the second output unit 26, where the fourthpop-up prompt is a prompt message used to indicate that the temperatureof the charging cable is extremely high in the current charging processand charging is disconnected.

In a possible embodiment, the processing unit 23 is further configuredto receive, by using the receiving unit 22, an external charging voltagesent by the charge protection apparatus; and

the processing unit 23 is further configured to determine, based on theexternal charging voltage, whether to generate the circuit controlcommand.

In a possible embodiment, with regard to the determining, based on theexternal charging voltage, whether to generate the circuit controlcommand, the processing unit 23 is specifically configured to:

if the external charging voltage is greater than a first voltagethreshold and less than a second voltage threshold, determine that thegenerated circuit control command is to keep charging; or if theexternal charging voltage is greater than the second voltage threshold,determine that the generated circuit control command is to disconnectfrom charging.

In a possible embodiment, the user terminal 2 further includes the thirdoutput unit 27;

the processing unit 23 is further configured to: if the externalcharging voltage is greater than the first voltage threshold and lessthan the second voltage threshold, output a fifth pop-up prompt on thescreen by using the third output unit 27, where the fifth pop-up promptis a prompt message used to indicate that the external charging voltageis extremely high in the current charging process; and

the processing unit 23 is further configured to: if the externalcharging voltage is greater than the second voltage threshold and lessthan the third voltage threshold, output a sixth pop-up prompt on thescreen by using the third output unit 27, where the sixth pop-up promptis a prompt message used to indicate that the external charging voltageis extremely high in the current charging process and charging isdisconnected.

In a possible embodiment, the user terminal 2 further includes thefourth output unit 28; and

the processing unit 23 is further configured to output the internalcharging current, the external charging current, and the externalcharging voltage on the screen by using the fourth output unit 28.

In a possible embodiment, a first warning prompt is set in the circuitcontrol command, and the first warning prompt is used to instruct thecharge protection apparatus to perform a warning operation according tothe first warning prompt.

In a possible embodiment, at least one prompt mode and a time intervalfor executing each prompt mode are set in the first warning prompt.

In a possible embodiment, the processing unit 23 is further configuredto perform a warning operation based on a preset second warning promptif the circuit control command is generated, where the second warningprompt includes at least one prompt mode.

It should be noted that, functions and beneficial effects of functionalunits of the user terminal 2 described in this embodiment of the presentinvention may be specifically described according to the method in themethod embodiment shown in FIG. 4 or FIG. 5 . Details are not describedherein again.

In this embodiment, the user terminal 2 is presented in a form of afunctional unit. The “unit” herein may be an application-specificintegrated circuit (application-specific integrated circuit, ASIC), acircuit, a processor executing one or more software or firmwareprograms, an integrated logic circuit, and/or another component capableof providing the foregoing functions. In a simple embodiment, a personskilled in the art may figure out that a user terminal shown in FIG. 10may be used for the user terminal in the embodiment shown in FIG. 9 . Asshown in FIG. 10 , FIG. 10 is a schematic structural diagram of a userterminal according to an embodiment of the present invention. The userterminal 2000 includes at least one processor 2001, a bus 2002, atransceiver 2004, and a charging control IC 2005.

The processor 2001 and the transceiver 2004 are connected, for example,by using the bus 2002. Optionally, the user terminal 2000 may furtherinclude a memory 2003, the memory 2003 is configured to store data ofthe user terminal 2000 or store application program code used to executethe solutions of the present invention, and the processor 2001 isconfigured to control the execution. The processor 2001 is configured toexecute the application program code stored in the memory 2003, toimplement an action of the user terminal in the embodiment shown in FIG.4 or FIG. 5 .

Further, optionally, the user terminal 2000 may further include an audiofrequency system 2006, an oscillator 2007, and/or a display system 2008.The audio frequency system 2006 is configured to output an audiofrequency signal. The oscillator 2007 is configured to perform anoscillation operation. The display system 2008 is configured to outputand display information and receive an operation input by a user.

It should be noted that, a quantity of transceivers 2004 is not limitedin an actual application, and the user terminal 2000 does not impose alimitation on the embodiments of the present invention.

The processor 2001 in this embodiment of the present invention isconfigured to implement a function of the processing unit 23 shown inFIG. 9 . The transceiver 2004 includes a receiver and a transmitter. Thetransceiver 2004 in this embodiment of the present invention isconfigured to implement functions of the receiving unit 22 and thesending unit 24 shown in FIG. 9 . The charging control IC in thisembodiment of the present invention is configured to implement afunction of the detection unit 21 shown in FIG. 9 . The display system2008 in this embodiment of the present invention is configured toimplement functions of the first output unit 25, the second output unit26, the third output unit 27, and/or the fourth output unit 28 shown inFIG. 9 . The audio frequency system 2006 and the oscillator 2007 areconfigured to output a plurality of prompt modes in the second warningprompt executed by the processor 2001.

The processor 2001 may be a central processing unit (Central ProcessingUnit, CPU), a general-purpose processor, a digital signal processor(Digital Signal Processor, DSP), an application-specific integratedcircuit (Application-Specific Integrated Circuit, ASIC), afield-programmable gate array (Field-Programmable Gate Array, FPGA) oranother programmable logic device, a transistor logic device, a hardwaredevice, or any combination thereof. The processor 2001 may implement orexecute various example logical blocks, modules, and circuits describedwith reference to content disclosed in the present invention.Alternatively, the processor 2001 may be a combination for implementinga computing function, for example, a combination including one or moremicroprocessors, a combination of a DSP and a microprocessor, or thelike.

The bus 2002 may include a channel, used to transmit information betweenthe foregoing components. The bus 2002 may be a Peripheral ComponentInterconnect (Peripheral Component Interconnect, PCI) bus, an extendedindustry standard architecture (Extended Industry Standard Architecture,EISA) bus, or the like. The bus 2002 may be classified into an addressbus, a data bus, a control bus, and the like. For ease ofrepresentation, the bus is represented by using only one bold line inFIG. 10 . However, this does not mean that there is only one bus or onetype of bus.

The memory 2003 may be a read-only memory (read-only memory, ROM) oranother type of static storage device capable of storing staticinformation and instructions, a random access memory (random accessmemory, RAM) or another type of dynamic storage device capable ofstoring information and instructions, or may be an electrically erasableprogrammable read-only memory (Electrically Erasable ProgrammableRead-Only Memory, EEPROM), a compact disc read-only memory (Compact DiscRead-Only Memory, CD-ROM) or another compact disc storage, an opticaldisc storage (including a compressed optical disc, a laser disc, anoptical disc, a digital universal optical disc, a Blu-ray disc, and thelike), a magnetic disk storage medium or another magnetic storagedevice, or any other medium capable of carrying or storing expectedprogram code in a form of instructions or data structures and capable ofbeing accessed by a computer. However, this is not limited herein.

An embodiment of the present invention further provides a computerstorage medium, configured to store a computer software instruction usedby the user terminal, and the computer software instruction includes aprogram designed for the user terminal to execute the foregoing methods.

It should be noted that, for ease of description, the foregoing methodembodiments are represented as a series of actions. However, a personskilled in the art should appreciate that the present invention is notlimited to the described order of the actions, because according to thepresent invention, some steps may be performed in other orders orsimultaneously. In addition, a person skilled in the art should alsoappreciate that all the embodiments described in this specification areexample embodiments, and the related actions and modules are notnecessarily mandatory to the present invention.

In the foregoing embodiments, the descriptions of the embodiments haverespective focuses. For a part that is not described in detail in anembodiment, refer to related descriptions in other embodiments.

A sequence of the steps of the method in the embodiments of the presentinvention may be adjusted, and steps may also be merged or removed asactually required.

Merging, division, and removing may be performed on the units in theapparatus in the embodiments of the present invention as actuallyrequired. A person skilled in the art may combine different embodimentsand features of different embodiments described in this specification.

With descriptions of the foregoing embodiments, a person skilled in theart may clearly understand that the present invention may be implementedby hardware, firmware, or a combination thereof. When the presentinvention is implemented by software, the foregoing functions may bestored in a computer-readable medium or transmitted as one or moreinstructions or code in the computer-readable medium. Thecomputer-readable medium includes a computer storage medium and acommunications medium, where the communications medium includes anymedium that enables a computer program to be transmitted from one placeto another. The storage medium may be any available medium accessible toa computer. The computer-readable medium may include but is not limitedto: a random access memory (Random Access Memory, RAM), a read-onlymemory (Read-Only Memory, ROM), an electrically erasable programmableread-only memory (Electrically Erasable Programmable Read-Only Memory,EEPROM), a compact disc read-only memory (Compact Disc Read-Only Memory,CD-ROM) or another optical disk storage, a disk storage medium oranother disk storage, or any other medium capable of carrying or storingexpected program code in a form of instructions or data structures andcapable of being accessed by a computer. In addition, any connection maybe appropriately defined as a computer-readable medium. For example, ifsoftware is transmitted from a website, a server, or another remotesource by using a coaxial cable, an optical fiber/cable, a twisted pair,a digital subscriber line (Digital Subscriber Line, DSL) or wirelesstechnologies such as infrared ray, radio, and microwave, the coaxialcable, optical fiber/cable, twisted pair, DSL or wireless technologiessuch as infrared ray, radio, and microwave are included in definitionsof a medium to which they belong. For example, a disk (Disk) and a disc(disc) used by the present invention include a compact disc (CD), alaser disc, an optical disc, a digital versatile disc (DVD), a floppydisk, and a Blu-ray disc, where the disk generally copies data by amagnetic means, and the disc copies data optically by a laser means. Theforegoing combination should also be included in the protection scope ofthe computer-readable medium.

In conclusion, what is described above is merely example embodiments ofthe technical solutions of the present invention, but is not intended tolimit the protection scope of the present invention. Any modification,equivalent replacement, or improvement made without departing from thespirit and principle of the present invention shall fall within theprotection scope of the present invention.

What is claimed is:
 1. An electronic device, comprising: a battery; adisplay interface; a charging port; a memory configured to store programcode; and a processor coupled to the battery, the display interface, thecharging port, and the memory and configured to execute the program codeto cause the electronic device to: charge the battery using the chargingport when a charger is connected to the charging port; stop charging thebattery in response to detecting that the charging port is abnormal; anddisplay a first window on the display interface in response to detectingthat the charging port is abnormal, wherein the first window comprisesfirst prompt information and second prompt information, wherein thefirst prompt information prompts that liquid is in the charging port,and wherein the second prompt information prompts a user to addressliquid intake in the charging port.
 2. The electronic device of claim 1,wherein the first window further comprises third prompt information thatprompts that the electronic device is disconnected from charging.
 3. Theelectronic device of claim 1, wherein the charging port comprises auniversal serial bus (USB) port.
 4. The electronic device of claim 1,wherein the first window further comprises a first option, and whereinthe processor is further configured to execute the program code to causethe electronic device to charge the battery using the charging port inresponse to an operation on the first option.
 5. The electronic deviceof claim 1, wherein the charging port is abnormal when at least one of acharging current, a charging voltage, or a temperature of the electronicdevice is greater than a threshold.
 6. The electronic device of claim 1,wherein a leakage current exists in a charging process of the electronicdevice, and wherein the second prompt information indicates that theliquid is in the charging port.
 7. The electronic device of claim 4,wherein the first option is a cancel option.
 8. The electronic device ofclaim 7, wherein the electronic device is a mobile phone, a tabletcomputer, or a wearable device.
 9. The electronic device of claim 1,wherein the processor is further configured to execute the program codeto cause the electronic device to generate a circuit control command tocontinue charging the battery.
 10. A method for detecting liquid intakeand implemented by an electronic device, wherein the method comprises:charging a battery of the electronic device using a charging port of theelectronic device when a charger is connected to the charging port;stopping charging the battery in response to detecting that the chargingport is abnormal; and displaying a first window on a display interfaceof the electronic device in response to detecting that the charging portis abnormal, wherein the first window comprises first prompt informationand second prompt information, wherein the first prompt informationprompts that liquid is in the charging port, and wherein the secondprompt information prompts a user to address liquid intake in thecharging port.
 11. The method of claim 10, wherein the first windowfurther comprises third prompt information that prompts that theelectronic device has been disconnected from charging.
 12. The method ofclaim 10, wherein the charging port comprises a universal serial bus(USB) port or a Lightning port.
 13. The method of claim 10, wherein thefirst window further comprises a first option, and wherein the methodfurther comprises continuing to charge the battery through the chargingport in response to an operation on the first option.
 14. The method ofclaim 10, wherein the charging port is abnormal when at least one of acharging current, a charging voltage, or a temperature of the electronicdevice is greater than a threshold.
 15. The method of claim 10, whereina leakage current exists in a charging process of the electronic device,and wherein the second prompt information indicates that the liquid isin the charging port.
 16. The method of claim 13, wherein the firstoption is a cancel option.
 17. The method of claim 16, wherein theelectronic device is a mobile phone, a tablet computer, or a wearabledevice.
 18. The method of claim 10, further comprising generating acircuit control command to continue and enable charging the battery. 19.The electronic device of claim 1, wherein the charging port comprises aLightning port.
 20. A computer program product comprising instructionsthat are stored on a computer-readable medium and that, when executed bya processor, cause an electronic device to: charge a battery of theelectronic device using a charging port of the electronic device when acharger is connected to the charging port; stop charging the battery inresponse to detecting that the charging port is abnormal; and display afirst window on a display interface of the electronic device in responseto detecting that the charging port is abnormal, wherein the firstwindow comprises first prompt information and second prompt information,wherein the first prompt information prompts that liquid is in thecharging port, and wherein the second prompt information prompts a userto address liquid intake in the charging port.